﻿@using Microsoft.AspNetCore.Identity
@inject SignInManager<IdentityUser> SignInManager
@inject UserManager<IdentityUser> UserManager

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - OneoneNine</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/css/site.css" />
</head>
<body>
    <header>
        <nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
            <div class="container">
                <a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">OneoneNine</a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
                        aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
                    <ul class="navbar-nav flex-grow-1">
                        <li class="nav-item">
                            <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
                        </li>
                        @if (SignInManager.IsSignedIn(User) && !User.IsInRole("管理员"))
                        {
                            <li class="nav-item">
                                @*<a class="nav-link text-dark" asp-area="" asp-controller="Examines" asp-action="Index">请假</a>*@
                                <a onclick="redirectToAnotherViewc2()">个人信息管理</a>
                            </li>
                            <li class="nav-item">
                                @*<a class="nav-link text-dark" asp-area="" asp-controller="Examines" asp-action="Index">请假</a>*@
                                <a onclick="redirectToAnotherViewc()">请假</a>
                            </li>

                        }
                        @*<a class="nav-link text-dark" asp-area="" asp-controller="Examines" asp-action="Index">查看请假记录</a>*@
                        <span id="Name"> @User.Identity.Name</span>

                        <script>
                            function redirectToAnotherViewc() {
                                const name = document.getElementById("Name");
                                console.log(name.innerText)
                                window.location.href = "/Examines/Index?name=" + name.innerText;
                            };

                            function redirectToAnotherViewc2() {
                                const name = document.getElementById("Name");
                                console.log(name.innerText)
                                window.location.href = "/User/Index?Name=" + name.innerText;

                            };
                        </script>

                        @if (User.IsInRole("管理员"))
                        {
                            @*<li class="nav-item">
                <a class="nav-link text-dark" asp-area="" asp-controller="Admin" asp-action="Index">请假记录</a>
            </li>*@
                            <li class="nav-item">
                                <a class="nav-link text-dark" asp-area="" asp-controller="Audit" asp-action="Index">审核</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link text-dark" asp-area="" asp-controller="Admin" asp-action="Index">用户管理</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link text-dark" asp-area="" asp-controller="Role" asp-action="Index">权限管理</a>
                            </li>
                        }
                    </ul>
                    <partial name="_LoginPartial" />
                </div>
            </div>
        </nav>
    </header>
    <div class="container">
        <main role="main" class="pb-3">
            @RenderBody()
        </main>
    </div>

    <footer class="border-top footer text-muted">
        <div class="container">
            &copy; 2023 - OneoneNine - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
        </div>
    </footer>
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="~/js/site.js" asp-append-version="true"></script>
    @await RenderSectionAsync("Scripts", required: false)
</body>
</html>
